package gphoto;

import gphoto.bo.PhotoBean;
import gphoto.services.impl.PhotoServicesImpl;

import java.io.File;
import java.io.IOException;
import java.util.List;

import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import org.apache.sanselan.ImageReadException;

import com.drew.imaging.jpeg.JpegProcessingException;
import com.drew.metadata.MetadataException;

public class Test {

	private final static Logger log = Logger.getLogger(Test.class);

	public static List<PhotoBean> photos = null;

	public static void main(String[] args) throws JpegProcessingException,
			MetadataException, ImageReadException, IOException {

		DOMConfigurator.configure("log4j.xml");

		PhotoBean p = new PhotoBean(
				new File(
						"C:\\Documents and Settings\\arnaud\\Mes documents\\Mes images\\IMG_0139.jpg"));

		PhotoServicesImpl.getInstance().alimenterMetadata(p);
		p.afficherMetadata();
		log.info("->" + p.getDateForDisplay());
		log.info("->" + p.getDimension());

		p = new PhotoBean(
				new File(
						"C:\\Documents and Settings\\arnaud\\Mes documents\\Mes images\\IMG_0139.jpg"));

		PhotoServicesImpl.getInstance().setEXIFInformationToPhoto(p);
		log.info("->" + p);
		log.info("->" + p.getDateForDisplay());
		log.info("->" + p.getDimension());
		/*
		 * File rep = new File(
		 * "C:\\Documents and Settings\\arnaud\\Mes documents\\Mes images");
		 * photos = PhotoServicesImpl.getInstance().recupererPhotos(rep, true);
		 * 
		 * for (int i = 0; i < photos.size(); i++) { System.out.println("" +
		 * photos.get(i).getNom()); System.out.println("" +
		 * photos.get(i).getDateTimeForDisplay()); }
		 */

	}
}
